import { MenuItem } from "@/types/router";
export const matchRouter = (path: string, routers: MenuItem[]) => {
    let result = {};
    for (const item of routers) {
        if (item.path === path) {
            return item
        }
        if (item.children && item.children.length) {
            const res = matchRouter(path, item.children)
            if (Object.keys(res).length) {
                result = res
            }
        }
    }
    return result

}